package com.demo2do.fms.entity.vehicle.source;

import com.demo2do.core.utils.Alias;

/**
 * 
 * @author mohanlan
 *
 */
@Alias("VehicleSyncStatus")
public enum SyncStatus {
    
    UNSYNC("unsync", "整车编辑"),           // 已绑定， 未同步至MDM
    
    SYNCING("syncing", "待引入"),          // 待同步MDM
    
    SYNCED("synced", "已引入"),            // 已引入MDM
    
    REJECTED("rejected", "已驳回");        // 引入被驳回
    
    private String alias;
    
    private String description;
    
    /**
     * @param alias
     * @param description
     */
    private SyncStatus(String alias, String description) {
        this.alias = alias;
        this.description = description;
    }

    /**
     * 
     * @param alias
     * @return
     */
    public static SyncStatus aliasOf(String alias) {
        for (SyncStatus syncStatus : SyncStatus.values()) {
            if (syncStatus.getAlias().equalsIgnoreCase(alias)) {
                return syncStatus;
            }
        }
        return null;
    }
    
    /**
     * @return
     */
    public boolean isUnsync() {
        return this.equals(UNSYNC);
    }
    
    /**
     * @return
     */
    public boolean isSyncing() {
        return this.equals(SYNCING);
    }
    
    /**
     * @return
     */
    public boolean isSynced() {
        return this.equals(SYNCED);
    }
    
    /**
     * @return
     */
    public boolean isRejected() {
        return this.equals(REJECTED);
    }

    /**
     * @return the alias
     */
    public String getAlias() {
        return alias;
    }

    /**
     * @return the description
     */
    public String getDescription() {
        return description;
    }

}
